package com.czy.ekp.template;


import com.czy.ekp.util.ResultMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/template")
public class TemplateController {

    @Autowired
    TemplateService templateService;


    @GetMapping("/listTemplateFiles")
    @ResponseBody
    public ResultMap listTemplateFiles(String path){
        return ResultMap.success().setData(templateService.listTemplateFiles(path));
    }

    @GetMapping("/getFileContent")
    @ResponseBody
    public ResultMap getFileContent(String filePath){
        return templateService.getFileContent(filePath);
    }

    @PostMapping("/updateTemplateFile")
    @ResponseBody
    public ResultMap updateTemplateFile(String filePath, String content){
        return templateService.updateTemplateFile(filePath, content);
    }


}
